home *** CD-ROM | disk | FTP | other *** search
- Path: dd.chalmers.se!news.chalmers.se!sunic!EU.net!howland.reston.ans.net!cs.utexas.edu!rutgers!concert!sas!mozart.unx.sas.com!jamie
- From: jamie@cdevil.unx.sas.com (James Cooper)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Find device name and unit number
- Message-ID: <CKpKFK.A6u@unx.sas.com>
- Date: 4 Feb 94 16:28:29 GMT
- References: <2isjec$8ok@midland.co.nz>
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Organization: SAS Institute Inc.
- Lines: 49
- Originator: jamie@cdevil.unx.sas.com
- Nntp-Posting-Host: cdevil.unx.sas.com
-
-
- In article <2isjec$8ok@midland.co.nz>, pid@midland.co.nz (Philip D'Ath) writes:
- >I am maintaining an application, and need to be able to find out the device
- >name and unit number from a reference such as "DH0".
- >
- >So, for example, lets say that someone has a GVP hard drive, that is
- >called DH0:. If DH0: is selected, then I want to be able to find out
- >that it is using the device "gvpscsi.device", and unit x.
- >
- >I've had a look through a reasonable amount of documentation, but haven't
- >managed to find a method to do this yet.
-
- #include <dos/dosextens.h>
- #include <dos/filehandler.h>
-
- ...
- struct DosList *dlist, *tdlist;
- struct FileSysStartupMsg *fssm;
- ULONG unit;
- char dvrname[34], *nptr;
- int i;
-
- dlist = LockDosList(LDF_DEVICES|LDF_READ);
-
- tdlist = dlist;
- tdlist = FindDosEntry(tdlist, "DH0", LDF_DEVICES);
-
- fssm = (struct FileSysStartupMsg *)BADDR(tdlist->dol_Startup);
-
- strcpy(dvrname, (char *)BADDR(fssm->fssm_Device));
- unit = fssm->fssm_Unit;
-
- UnLockDosList(LDF_DEVICES|LDF_READ);
- ...
-
- At this point, 'unit' contains the unit number, and 'drvname' has the
- device driver name... you'll need to add appropriate error checking, of
- course, and this will only work under 2.0+ of the OS...
-
-
- --
- ---------------
- Jim Cooper
- (jamie@unx.sas.com) bix: jcooper
-
- Any opinions expressed herein are mine (Mine, all mine! Ha, ha, ha!),
- and not necessarily those of my employer.
-
- Remember, "Euphemisms are for the differently brained."
-